package net.wanho.index.service.impl;

import net.wanho.commons.exception.DaoException;
import net.wanho.commons.exception.ServiceException;
import net.wanho.commons.factory.BeanFactory;
import net.wanho.customerManage.vo.BusinessAndCustomerVo;
import net.wanho.index.dao.IndexDao;
import net.wanho.index.service.IndexService;
import net.wanho.personalOffice.dao.IndividualTaskDao;
import net.wanho.personalOffice.po.IndividualTask;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class IndexServiceImpl implements IndexService {
    private IndividualTaskDao individualTaskDao = BeanFactory.getBean(IndividualTaskDao.class) ;
    private IndexDao indexDao = BeanFactory.getBean(IndexDao.class) ;
    @Override
    public Map<String, Object> countAll(Integer employeeId) throws ServiceException {
        try {
            List<IndividualTask> individualTaskList = individualTaskDao.selectIndividualTaskByEmployeeId(employeeId);
            List<BusinessAndCustomerVo> businessAndCustomerVoList = indexDao.selectCurrMonthBusinessAndCustomerVo();
            Map<String, Integer> countAllMap = indexDao.countAll();
            Map<String, Object> map = new HashMap<>(3);
            map.put("individualTaskList",individualTaskList) ;
            map.put("businessAndCustomerVoList",businessAndCustomerVoList) ;
            map.put("countAllMap",countAllMap) ;
            return map ;
        } catch (DaoException e) {
            e.printStackTrace();
            throw new ServiceException(e.getMessage()) ;
        }
    }
}
